' TAMS 1887 USB Switch Controller example
' Change the pulse time of a switch.

Imports VBexamples.tamsSC
Public Class example3
    Sub example3()

        Dim handle As IntPtr

        handle = tamsSCstart("")
        If INVALID_HANDLE_VALUE = handle.ToInt32 Then
            MsgBox(tamsSCerror(), MsgBoxStyle.OKOnly, "Error")
            Exit Sub
        End If

        ' Pulse Time is the number of milliseconds that the switch needs current in order to latch.
        ' See the switch datasheet.  
        ' Agilent 18xx and 87xx switches use 15mS.

        ' 15mS is the default for the TAMS USB Switch Controller.

        ' Set the pulse time on switch 4 to 20mS.

        tamsSCsetPulseTime(handle, SWITCH_4, 20)

        ' Optionally:  with error checking.

        If FAIL = tamsSCsetPulseTime(handle, SWITCH_4, 20) Then
            MsgBox(tamsSCerror(), MsgBoxStyle.OKOnly, "Error")
            Exit Sub
        End If

        tamsSCend(handle)
    End Sub
End Class
